package com.netease.examination.dto;

/**
 * designed by destiny
 *
 * @author destiny
 *         e-mail destinywk@163.com
 *         github https://github.com/DestinyWang
 *         oschina https://git.oschina.net/destinywk
 * @version JDK 1.8.0_101
 * @since 2017/3/15 16:59
 */
public class ResultDTO<T> {

    // 是否成功
    private Boolean success;
    // 数据（成功时使用）
    private T data;
    // 错误信息（失败时使用）
    private String error;

    /**
     * 如果为真，需要数据
     *
     * @param success   是否成功
     * @param data      返回数据
     */
    public ResultDTO(Boolean success, T data) {
        this.success = success;
        this.data = data;
    }


    /**
     * 如果为假，需要错误信息
     *
     * @param success   是否成功
     * @param error     错误信息
     */
    public ResultDTO(Boolean success, String error) {
        this.success = success;
        this.error = error;
    }

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }
}
